<cake:nocache>
<?php
	$this->Paginator->options(array('url' => array('admin' => true, 'plugin' => null, 'controller' => 'reviews', 'action' => 'index')));
?>
<div class="locations index" style="width:80%">
	<h2><?php echo 'Сайт - дестинации'; ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
		<th width="">
		<?php
			echo $this->Paginator->sort(
				'ID',
				'id'
			);
		?>
		</th>
		<th width="">
		<?php
			echo $this->Paginator->sort(
				'Name',
				'name'
			);
		?>
		</th>
		<th width="100px">
		<?php
			echo $this->Paginator->sort(
				'Rating',
				'rate'
			);
		?>
		</th>
		<th width="">
		<?php
			echo $this->Paginator->sort(
				'Content',
				'content'
			);
		?>
		</th>
		<th width="150"><?php echo 'Listing'; ?></th>
		<th width="">
		<?php
			echo $this->Paginator->sort(
				'Status',
				'status'
			);
		?>
		</th>
		<th width="" class="actions"><?php echo 'Action'; ?></th>
		
	</tr>
	<?php
	$i = 0;
	foreach ($reviews as $review) {
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
		<tr<?php echo $class;?>>
			<td>
				<?php echo $review['Review']['id']; ?>
			</td>
			<td>
				<?php echo htmlspecialchars($review['Review']['name']); ?>
			</td>
			<td>
				<?php 
					$i_MaxEn = $review['Review']['rate'];
					$i_MaxDis = 5 - $i_MaxEn;
				?>
				<?php for( $i = 0; $i < $i_MaxEn; $i ++ ) :?>
					<img src="<?php echo SITE_WEBROOT; ?>img/stars_enabled.png" width="15"/>
				<?php endfor;?>
				<?php for( $i = 0; $i < $i_MaxDis; $i ++ ) :?>
					<img src="<?php echo SITE_WEBROOT; ?>img/stars_disabled.png" width="15"/>
				<?php endfor;?>
			</td>
			<td>
				<?php echo htmlspecialchars($review['Review']['content']); ?>
			</td>
			<td>
				<?php echo htmlspecialchars($review['Review']['listing']); ?>
			</td>
			
			<td>
				<?php
				if($review['Review']['status'] == 1) {
					echo '<span style="color: green">Approved</span>';
				} else {
					echo '<span style="color: red">Disapproved</span>';
				}
				?>
			</td>
			<td class="actions">
				<?php
				if($review['Review']['status'] == 1) {
					echo $this->Html->link('Disapprove', array('admin' => true, 'plugin' => null, 'controller' => 'reviews', 'action' => 'approve', $review['Review']['id']));
				} else {
					echo $this->Html->link('Approve', array('admin' => true, 'plugin' => null, 'controller' => 'reviews', 'action' => 'approve', $review['Review']['id']));
				}
				?>
				<?php echo $this->Html->link('Delete', array('admin' => true, 'plugin' => null, 'controller' => 'reviews', 'action' => 'delete', $review['Review']['id']), null, sprintf('Do you want to delete # %s?', $review['Review']['id'])); ?>
			</td>
		</tr>
	<?php } ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => 'Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on record %end%'
	));
	?></p>
	<div class="paging">
		<?php echo $this->Paginator->prev('<< '.'Previous', array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
	 |
		<?php echo $this->Paginator->next('Next'.' >>', array(), null, array('class'=>'disabled'));?>
	</div>
</div>
<div class="actions">
	
</div>
</cake:nocache>